package com.csl.xm.demo.controller;

import com.csl.xm.demo.base.controller.BaseController;
import com.csl.xm.demo.base.utils.StateParameter;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * <pre>
 * 描述：第一个控制器
 * </pre>
 *
 * @类名：com.csl.xm.demo.controller.FirstController
 * @作者： 1410HL0236
 * @创建日期: 2019/11/19 15:59
 */
@Controller
@RequestMapping(value = "/first")
public class FirstController extends BaseController {

  @RequestMapping(value = "/view")
  public String view(HttpServletRequest request){
    logger.info("进入测试页面");
    return "/demoPage/firstPage";
  }

  @PostMapping(value = "/back")
  @ResponseBody
  public ModelMap back(HttpServletRequest request) {
    logger.info("进入json测试页面");
    return getModelMap(StateParameter.SUCCESS, null, "请求成功");
  }
}
